Answer:
The sentence you provided is grammatically correct, however the meaning is bit unclear because there is no context of what the person is talking about. The statement "I wouldn't have asked you if you were ok" implies that the speaker has asked the listener if they are okay, but if that wasn't the case, it might be confusing for the listener. It could be better understood if it's placed in context and gives more information about the situation.